<%@ page import="com.model.Project" %>
<%@ page import="java.util.List" %>
<%@ page import="com.model.Teacher" %>
<%@ page import="com.bean.ProjectTeacherBean" %><%--
  Created by IntelliJ IDEA.
  User: chaiyuan
  Date: 2017/5/8
  Time: 2:17
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<nav class="navbar navbar-default">
    <div class="container-fluid">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar bar1"></span>
                <span class="icon-bar bar2"></span>
                <span class="icon-bar bar3"></span>
            </button>
            <a class="navbar-brand" href="#">审核列表</a>
        </div>
        <div class="collapse navbar-collapse">

            <ul class="nav navbar-nav navbar-right">
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                        <i class="ti-user"></i>

                        <p>您好！${sessionScope.user.name}</p>
                        <b class="caret"></b>
                    </a>
                    <ul class="dropdown-menu">
                        <li><a href="#">修改信息</a></li>
                        <li><a href="#">退出登录 </a></li>

                    </ul>
                </li>

            </ul>

        </div>
    </div>
</nav>
<div class="content">
    <div class="container-fluid">
        <div class="row">
            <div class="col-md-12">
                <div class="card">
                    <div class="header">
                        <h4 class="title">课题列表</h4>
                        <p class="category">再可选的课题前单选即可</p>
                    </div>
                    <div class="content table-responsive table-full-width">
                            <table class="table table-striped">
                                <thead>
                                <th>#</th>
                                <th>课题名称</th>
                                <th>课题简介</th>
                                <th>设题教师</th>
                                <th>状态</th>
                                <th colspan="2" style="text-align: center">操作</th>
                                </thead>
                                <tbody>
                                <%

                                    List<ProjectTeacherBean> project = (List) request.getAttribute("list");
                                    for (int i = 0; i < project.size(); i++) {
                                %>
                                <tr>
                                    <%--<td><input type="radio" name="selected" value=<%=project.get(i).getStudent().getStr("stu_id")%>></td>--%>
                                    <td><%=i+1%>
                                    </td>
                                    <td><%=project.get(i).getProject().getStr("name")%>
                                    </td>
                                    <td><%=project.get(i).getProject().getStr("introduce")%>
                                    </td>
                                    <td><%=project.get(i).getTeacher().getStr("name")%>
                                    </a></td>
                                    <td><%int status = project.get(i).getProject().getInt("status");
                                         switch (status){
                                             case 0:
                                                 %>
                                        未审核
                                        <%break;
                                            case 1:%>
                                        已通过
                                        <%break;
                                            case 2:%>
                                        已拒绝

                                   <%   break;
                                           default:
                                         break;}
                                    %>
                                    </td>
                                    <td style="text-align: center"><a href="javascript:void(0)" onclick="onSubmit(<%=project.get(i).getProject().getInt("id")%>,1)">通过</a></td>
                                        <td style="text-align: center"><a href="javascript:void(0)" onclick="onSubmit(<%=project.get(i).getProject().getInt("id")%>,2)">拒绝</a></td>

                                </tr>
                                <%}%>

                                </tbody>
                            </table>



                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script type="text/javascript">
    function onSubmit(pro_id,status) {
        $.ajax({
            method:"get",
            url:"/admin/audit/"+pro_id+"-"+status,
            data:{


            },
            success:function (data) {
                alert("已通过");
                window.location.href="/admin";
            },

        });
    }
</script>
</html>
